{% extends "light.twig" %}
{% block title %}: {{ vocab.title }}{% endblock %}
{% block headernav %}
<ul class="nav nav-tabs">
  <li class="active"><a href="{{ path_fix }}{{ vocab_id }}/{{ lang }}/index">{% trans "Alpha-nav" %}</a></li>
  {% if vocab.showHierarchy %}
  <li><a href="#" id="hier-trigger">{% trans "Hier-nav" %}</a></li>
  {% endif %}
  {% if vocab.groupClassURI %}
  <li><a href="{{ path_fix }}{{ vocab_id }}/{{ lang }}/groups">{% trans "Group-nav" %}</a></li>
  {% else %}
  {% endif %}
</ul>
{% endblock %}
{% block sidebar %}
<div class="container" id="alphabetical-menu">
{% set letters = 'A'..'Z' %} {# it would be nicer to do this according to the actual appearances of letters i.e. only letters with results should be shown #}
{% set rest = ['Å', 'Ä', 'Ö', '!*'] %}
  <ul class="pagination">
  {% for letter in [['0-9'], letters, rest] %} {# looping through all letters #}
    {%  for letter2 in letter %}
      <li{% if search_letter == letter2 %} class="active"{% endif %}><a href="{{ path_fix }}{{ vocab_id }}/{{ lang }}/index/{{ letter2 }}">{{ letter2 }}</a></li>
    {% endfor %}
  {% endfor %}
  </ul>
  {% if search_results %}
    {% set previous = '' %}
    <ul class="list-group alphabetical-search-results side-navi">
      {% for key,value in search_results %}
      {% if all_letters == true %}
        {% set alpha = value.prefLabel|first %}{% if alpha != previous %}<li class="alphabet-header" name="{{ alpha }}"><h5>{{ alpha }}</h5></li>{% set previous = alpha %}{% endif %}
      {% endif %}
      <li>
      {% if value.altLabel %}
      {{ value.altLabel }} 	&rarr; <a href="{{ value.uri | link_url(vocab,lang) }}">{{ value.prefLabel }}</a>
      {% else %}
      <a href="{{ value.uri | link_url(vocab,lang) }}">{{ value.prefLabel }}</a>
      {% endif %}
     </li>
      {% endfor %}
    </ul>
    {% else %}<span class="header-text-small-font">{% trans %}Error: the vocabulary does not contain terms beginning with "{{ letter }}"!{% endtrans %}</span>
  {% endif %}
</div>
{% endblock %}
{% block content %}
<div class="container">
  {% if lang_supported == false %}
  <div class="row col-lg-12">
    <div id="lang-info" class="alert alert-danger">
      <h4>{{ lang_changed }}</h4>
    </div>
  </div>
  {% endif %}
  <div id="vocab-info" class="col-lg-12 boxed">
    <div class="col-lg-12">
      <h3 class="text-center">{% trans "Vocabulary information" %}</h3>
      {% if vocab.info %}
    </div>
    <div class="col-lg-12 vocab-info-literals">
      <table class="table table-striped">
        {% for key, values in vocab.info %}
        {% set keytrans = key %}
        <tr>
          <th>{{ keytrans|trans }} </th>
          <td>
            {% for val in values %}
            <div>{% if val[:7] == 'http://' %}<a href="{{ val }}">{{ val }}</a>{% else %}{{ val|nl2br }}{% endif %}</div>
            {% endfor %}
          </td>
        </tr>
        {% endfor %}
        <tr>
          <th>{% trans "Concepts" %}</th>
          <td>{{ vocab_stats.concepts }}</td>
        </tr>
      </table>
    </div>
    <div class="col-lg-12">
      <h3 class="text-center">{% trans "Concept counts by language" %}</h3>
      <table class="table table-striped" id="statistics">
      <tr>
        <th>{% trans "Concept language" %}</th>
        <th>{% trans "Preferred terms" %}</th>
        <th>{% trans "Alternate terms" %}</th>
        <th>{% trans "Hidden terms" %}</th>
      </tr>
      {% for lang,stats in vocab_stats['terms'] %}
      <tr>
        <td>{{ lang }}</td>
        <td>{{ stats['skos:prefLabel'] }}</td>
        <td>{{ stats['skos:altLabel'] }}</td>
        <td>{{ stats['skos:hiddenLabel'] }}</td>
      </tr>
      {% endfor %}
      </table>
    </div>
    {% endif %}
    {% if vocab.dataURL %}
    <div class="col-lg-12 text-center"><h4><a href="{{ path_fix }}rest/v1/{{ vocab_id }}/data"><span class="glyphicon glyphicon-floppy-save"></span> {% trans "Download" %}</a> {% trans "this vocabulary as SKOS/RDF" %}</h4>
    </div>
    {% endif %}
  </div>
</div>
{% endblock %}
